<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    // class类俗称构造函数的语法糖
    <script src="../../jquery-3.2.1.js"></script>
    <script>
        // 构造函数，函数名首字母大写
        function Promise(name, age) {
            this.name = name;
            this.age = age;
            this.jump = function () {
                console.log('于明杨睡一天！！！');

            }
        }

        // 实例对象
        let a1 = new Person('dewei', 19);
        console.log(a1);

        // 往原型对象上添加属性得方法
        Person.prototype.sex = '男';
        Person.prototype.hobby = function () {
            console.log('性别男，爱好-女');

        }
        Person.test = function () {
            console.log('Person自身的方法');

        }
        console.dir(Person);


        class Person {
            // 构造器
            constructor(name, age) {
                this.name = name;
                this.age = age;
                this.jump = function () {
                    console.log('于明杨去哪了！！！');
                    console.log(this); //实例对象
                }
            }
        }
    </script>
</body>

</html>